﻿using Connection.IModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Connection.Model
{
    [Serializable()]
    public class UserModel:IUserModel
    {
        private string _userId;
        private string _username;
        private string _password;
        private UserDB _userDB = new UserDB();

        public UserModel(string username)
        {
            this.Username = username;
        }

        public UserModel(string username, string password)
        {
            this.Username = username;
            this.Password = password;
        }

        public string UserId
        {
            get { return _userId; }
            set { _userId = value; }
        }

        public string Username
        {
            get { return _username; }
            set { _username = value; }
        }

        public string Password
        {
            get { return _password; }
            set { _password = value; }
        }
        
        public bool IsRightUsernamePassword()
        {
            if (_userDB.SelectUserId(this.Username, this.Password) == null)
                return false;
            else return true;
        }

        public bool IsRightUsername()
        {
            if (_userDB.SelectUserId(this.Username) == null)
                return false;
            else return true;
        }


        public int IsOnline()
        {
            throw new NotImplementedException();
        }
    }
}
